<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" width="85%" destroy-on-close @closed="$emit('closed')" align-center>
        <el-container>
            <el-main>
                <scTable ref="table" :apiObj="apiObj" @selection-change="selectionChange" stripe remoteSort remoteFilter border :params="query" height="650">
                    <el-table-column fixed label="收货单号" align="center" width="160" sortable>
                        <template #default="{row}">
                            <div>{{row.deliver_no}}</div>
                            <div>{{row.create_time}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column fixed label="缝挑合同单号" align="center" width="160" sortable>
                        <template #default="{row}">
                            <div>{{row.contract_no}}</div>
                            <div>{{row.create_time}}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="商品信息" fixed prop="goods" align="center" width="300">
                        <template #default="{row}">
                            <div class="shopInfo" v-if="row.goods">
                                <el-image class="img" :src="row.goods.goods_image" :preview-src-list="row.goods.goods_image_item" :initial-index="0" fit="cover" preview-teleported="true" />
                                <div class="right">
                                    <div>工厂货号：{{row.factory_number}}</div>
                                    <div>批次号：{{row.batch_number}}</div>
                                    <div>SKC：{{row.skc}}</div>
                                    <div>商品品牌：{{row.brand_name}}</div>
                                    <div>客户：{{row.custom_name}}</div>
                                    <div>颜色：{{row.goods.colour}}</div>
                                    <div v-if="row.sizeCate">商品类别：{{row.sizeCate.title}}</div>
                                </div>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column fixed label="尺码" align="center">
                        <template #default="{row}">
                            <div v-for="(item,index) in row.orderDetail" :key="index">
                                {{item.goods_size}}
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column fixed label="收货明细" prop="total_count" align="center">
                        <template #default="{row}">
                            <div v-for="(item,index) in row.orderDetail" :key="index">
                                {{item.num}}
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column fixed label="此单合计" prop="total_count" align="center"></el-table-column>
                    <el-table-column label="交货日期" prop="first_delivery_date" align="center" sortable>
                        <template #default="{row}">
                            {{row.contract.due_date}}
                        </template>
                    </el-table-column>
                    <el-table-column label="承制人" prop="referred_as" align="center"></el-table-column>
                    <el-table-column label="单价" prop="price" align="center">
                        <template #default="{row}">
                            {{row.contract.price}}
                        </template>
                    </el-table-column>
                </scTable>
            </el-main>
            <el-footer>
                <div style="display:flex;justify-content: end;">
                    <el-button @click="visible=false" >取消</el-button>
                </div>
            </el-footer>
        </el-container>
        <print ref="pitDialog"></print>
	</el-dialog>
</template>

<script>
import print from '@/views/order/print.vue';
	export default {
        components: { print },
		emits: ['success', 'closed'],
        props:{
            query: { type: String, default: "" },
        },
		data() {
			return {
				mode: "add",
				titleMap: {
					add: '收货明细',
					edit: '修改生产任务',
					show: '查看'
				},
                dialog: {
				    save: false,
                    pit:false,
			    },
				visible: false,
				isSaveing: false,
                apiObj:this.$API.produce.send.lists,
			}
		},
		mounted() {
		},
		methods: {
			//显示
			open(mode='add'){
				this.mode = mode;
				this.visible = true;
				return this
			},
			//表单注入数据
			async setData(data){
                console.log('data :>> ', data);
			},
		}
	}
</script>

<style lang="scss"></style>
